REBOL [
  Title:   "Generates run-each-comp.r run-each-interp.r"
	Author:  "Peter W A Wood"
	Version: 0.1.0
	Tabs:	 4
	Rights:  "Copyright (C) 2015 Peter W A Wood. All rights reserved."
	License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt"
]

;;--------------- initialisations 

;; make the file lists from all-tests.txt
file-list-comp: copy []
file-list-interp: copy []
all-tests: read/lines %all-tests.txt
foreach test all-tests [
	append file-list-comp copy test
	unless any [
		find test "routine"
		find test "evaluation"
	][
		append file-list-interp join "auto-tests/interp-" second split-path to file! test
	]
]

;;--------------- functions

;; write test file with header
write-test-header: func [file-out [file!]] [
	write file-out 
;;;;;; start text	
{
Rebol [
	Title:   "Red auto-generated test runner"
	Author:  "Peter W A Wood"
	License: "BSD-3 - https://github.com/dockimbel/Red/blob/origin/BSD-3-License.txt"
]

comment ^{
	This file is generated by make-run-each-runner.r
	Do not edit this file directly.
^}

}
;;;;;; end text
]

;;--------------- Main Processing

file-out: %auto-tests/run-each-comp.r
write-test-header file-out
foreach file file-list-comp [
	write/append file-out join "--run-test-file-quiet %source/units/" [file lf]	
]

file-out: %auto-tests/run-each-interp.r
write-test-header file-out 
foreach file file-list-interp [
	write/append file-out join "--run-test-file-quiet %source/units/" [file lf]
]
